package com.qar.controller;

import com.qar.domain.TUser;
import com.qar.resp.ResultData;
import com.qar.service.TUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private TUserService userService;
    @PostMapping("/add")
    public ResultData<Boolean> postUser(@RequestBody TUser user){
        return ResultData.success(userService.postUser(user));
    }


    @GetMapping("/{id}")
    public ResultData<TUser> getUserById(@PathVariable("id") Integer id){
        return ResultData.success(userService.getUserById(id));
    }
}
